import os

path = "123.txt"
# 获取后缀
file_ext = os.path.splitext(path)[-1]
print(f"File extension {file_ext}")

# 获取文件名，后缀
file_name, file_ext = os.path.splitext(path)
print(f"name: {file_name}, ext: {file_ext}")
